package cn.mw.cmdb.enums;

import io.swagger.annotations.ApiModelProperty;
import jdk.jfr.DataAmount;
import lombok.Data;

public enum ChartTypeEnum {
    line("line", "History", "折线图", false, true, true,false),
    rateLine("rateLine", "History", "占用率图", true, true, true,false),
    pie("pie", "LastValue", "饼状图", false, true, null,false),
    top5("top5", "LastValue", "top5图", false, true, null,false),
    table("table", "LastValue", "基础表格", false, true, null,true),
    advanceTable("advanceTable", "LastValue", "高级表格", false, true, null,true),
    text("text", "LastValue", "文本表格", false, false, false,true);

    private String itemName;

    private String queryType;

    private String desc;

    //是否需要百分比数据
    private boolean percentFlag;
    //是否监控项多选
    private boolean multipleFlag;
    //是否为数字数据
    private Boolean figureFlag;
    //是否监控项单位不做控制
    private boolean withoutUnitsFlag;

    public String getItemName() {
        return itemName;
    }

    public String getDesc() {
        return desc;
    }

    public boolean isPercentFlag() {
        return percentFlag;
    }

    public void setPercentFlag(boolean percentFlag) {
        this.percentFlag = percentFlag;
    }

    public boolean isWithoutUnitsFlag() {
        return withoutUnitsFlag;
    }

    public void setWithoutUnitsFlag(boolean withoutUnitsFlag) {
        this.withoutUnitsFlag = withoutUnitsFlag;
    }

    public boolean isMultipleFlag() {
        return multipleFlag;
    }

    public void setMultipleFlag(boolean multipleFlag) {
        this.multipleFlag = multipleFlag;
    }

    public boolean isFigureFlag() {
        return figureFlag;
    }

    public void setFigureFlag(boolean figureFlag) {
        this.figureFlag = figureFlag;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public String getQueryType() {
        return queryType;
    }

    public void setQueryType(String queryType) {
        this.queryType = queryType;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    ChartTypeEnum(String itemName, String queryType, String desc, boolean percentFlag, boolean multipleFlag, Boolean figureFlag, boolean withoutUnitsFlag) {
        this.itemName = itemName;
        this.queryType = queryType;
        this.desc = desc;
        this.percentFlag = percentFlag;
        this.multipleFlag = multipleFlag;
        this.figureFlag = figureFlag;
        this.withoutUnitsFlag = withoutUnitsFlag;
    }

    public static ChartTypeEnum getChartEnumByName(String itemName) {
        for (ChartTypeEnum homeItemEnum : values()) {
            if (homeItemEnum.getItemName().equals(itemName)) {
                return homeItemEnum;
            }
        }
        return line;
    }

    public Boolean getFigureFlag() {
        return figureFlag;
    }
}
